<script>
onpageshow = () => {
  debugger;
  if (!localStorage['state']) {
    localStorage['state'] = 'one';
    if (window.testRunner) {
      testRunner.dumpAsText();
      testRunner.waitUntilDone();
      testRunner.clearBackForwardList();
      testRunner.dumpBackForwardList();
    }
    setTimeout(() => {
      window.location.href = window.location.href + '?one';
    }, 0);
  } else if (localStorage['state'] === 'one') {
    localStorage['state'] = 'two';
    setTimeout(() => {
      window.location.href = window.location.href + '?two';
    }, 0);
  } else if (localStorage['state'] === 'two') {
    localStorage['state'] = 'done';
    var iframe = document.querySelector('#iframe');
    iframe.contentWindow.location.reload();
    window.history.back();
  } else {
    localStorage['state'] = '';
    if (window.testRunner)
      testRunner.notifyDone();
  }
}
</script>
<body>
  <p>
    Navigation initiated by history.back() should overwrite child frame reload,
    which was started eralier and did not finish yet.
    History state at the end should reflect the back() call.
  </p>
  <iframe id='iframe' src="about:blank"></iframe>
</body>
